cmake_minimum_required(VERSION 3.0)

set(PROJECT_NAME "vision")

project(${PROJECT_NAME})

# add_compile_options(-std=c++11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_BUILD_TYPE Debug)

find_package(OpenCV REQUIRED)
if (OpenCV_FOUND)
    # 找到opencv
    message(STATUS "OpenCV library status:")
    message(STATUS "    version: ${OpenCV_VERSION}")
    message(STATUS "    libraries: ${OpenCV_LIBS}")
    message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")
else()
    # 找不到
    message(STATUS "OpenCV library not find")
endif()

include_directories(${CMAKE_SOURCE_DIR}/inc ${CMAKE_SOURCE_DIR}/Socket/inc) 
file(GLOB SOURCE_FILES "src/*.cpp" "Socket/src/*.cpp")
add_executable(${PROJECT_NAME} main.cpp ${SOURCE_FILES})

target_compile_options(${PROJECT_NAME} PRIVATE -pthread)
target_link_libraries(${PROJECT_NAME} PRIVATE -pthread)


#OpenCV
target_include_directories(${PROJECT_NAME} PRIVATE ${OpenCV_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${OpenCV_LIBS})

#JSON_CPP
target_include_directories(${PROJECT_NAME} PRIVATE /usr/local/include)
link_directories(/usr/local/lib)
find_library(JSON_CPP libjsoncpp.a)
target_link_libraries(${PROJECT_NAME} PRIVATE ${JSON_CPP})

#MVC
include_directories(/opt/MVS/include /usr/include/X11) 
link_directories(/opt/MVS/lib/64)
set(MVS_CameraControl /opt/MVS/lib/64/libMvCameraControl.so)
# find_library(MVS_CameraControl libMvCameraControl.so)
target_link_libraries(${PROJECT_NAME} PRIVATE ${MVS_CameraControl})
target_link_libraries(${PROJECT_NAME} PRIVATE -lX11)

